﻿using System;

namespace Utility.Persistence_Service_Test.Entities
{
    public class Kinokarte
    {
        public virtual int Id { get; protected set; }

        public virtual string Barcode { get; set; }

        public virtual Besucher Besucher { get; set; }

        public virtual Kinosaal Kinosaal { get; set; }

        public override bool Equals(System.Object obj)
        {
            if (obj == null)
            {
                return false;
            }

            if (GetType() != obj.GetType())
            {
                return false;
            }

            Kinokarte karte = (Kinokarte)obj;

            return (Id.Equals(karte.Id)) && (Barcode.Equals(karte.Barcode)) &&
                (Besucher.Equals(karte.Besucher)) && (Kinosaal.Equals(karte.Kinosaal));
        }

        public override int GetHashCode()
        {
            int prime = 31;
            int result = 1;
            result = prime * result + Id.GetHashCode();
            result = prime * result + Barcode.GetHashCode();
            result = prime * result + Besucher.GetHashCode();
            result = prime * result + Kinosaal.GetHashCode();
            return result;
        }

        public override string ToString()
        {
            return "Kinokarte: {Id: " + this.Id.ToString() + ", Barcode: " + this.Barcode.ToString() +
                ", " + this.Besucher.ToString() + ", " + this.Kinosaal.ToString() + "}";
        }
    }
}
